<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>vue学习</title>
    <script src="./js/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <!--  
        .lazy - 监听 change 事件而不是 input
        .number - 将输入的合法字符串转为数字
        .trim - 移除输入内容两端空格
       -->
      <input type="number" v-model.number="n1" /> +
      <input type="number" v-model.number="n2" /> = {{ n1 + n2 }}
      <hr />
      <input type="text" v-model.trim.lazy="title" />
    </div>
    <script>
      const app = Vue.createApp({
        data() {
          return {
            title: '',
            n1: 1,
            n2: 2
          }
        }
      })
      app.mount('#app')
    </script>
  </body>
</html>
